home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / winsock / winftp.zip / WNFTPSRC.ZIP / WINFTP.H < prev    next >
C/C++ Source or Header  |  1994-01-06  |  14KB  |  458 lines

  1. /*
  2.   MODULE: WINFTP.H   (main program header file)
  3. */
  4.  
  5. #include <windows.h>
  6. #include <windowsx.h>
  7. #include <stdlib.h>
  8. #include "resource.h"
  9.  
  10. // **** Dialog box names
  11. // #define DLG_ABOUT                 510
  12. // #define DLG_HOST                  520
  13. // #define DLG_INPUT                 530
  14. // #define DLG_STATUS                540
  15.  
  16. // **** debug window menu definitions
  17. // may be used by other functions!
  18.  
  19. // under COMMAND popup menu
  20. #define CMD_CONNECT                 1010
  21. #define CMD_CLOSE                   1020
  22.  
  23. #define CMD_CWD                     1040
  24. #define CMD_DELE                    1050
  25. #define CMD_HELP                    1060
  26. #define CMD_LIST                    1070
  27. #define CMD_MKD                     1080
  28. #define CMD_NLST                    1090
  29. #define CMD_PWD                     1100
  30. #define CMD_QUOTE                   1110
  31. #define CMD_RETR                    1120
  32. #define CMD_RMD                     1130
  33. #define CMD_STATUS                  1140
  34. #define CMD_STOR                    1150
  35.  
  36. #define CMD_TYPE_I                  1170
  37. #define CMD_TYPE_A                  1180
  38.  
  39. #define CMD_SHFLAGS                 1200
  40.  
  41. // under OPTIONS popup menu
  42. #define OPT_SETVIEWER               1410
  43.  
  44. #define IDM_ABOUT                   1500
  45. #define IDM_EXIT                    1600
  46. #define IDM_DROPFILES               1610
  47.  
  48. // **** main window child window identifiers
  49. // TXT = static text windows
  50. // LST = list boxes
  51. // BTN = push buttons
  52. // RB  = radio buttons
  53.  
  54. // local side child windows
  55.  
  56. #define LST_DELFILES                2095
  57.  
  58. #define EDT_LFILETYPE               2105
  59. #define TXT_LDIRECTORY              2110
  60. #define LST_LDIRS                   2120
  61. #define LST_LDIRLST                 2125
  62. #define LST_LFILES                  2130
  63. #define BTN_LCHANGE                 2140
  64. #define BTN_LMKDIR                  2150
  65. #define BTN_LRMDIR                  2160
  66. #define BTN_LREFRESH                2175
  67. #define BTN_LHISTORY                2185
  68. #define BTN_LDISPLAY                2170
  69. #define BTN_LRENAME                 2180
  70. #define BTN_LDELETE                 2190
  71.  
  72. // remote side child windows
  73. #define TXT_HOSTNAME                2200
  74.  
  75. #define EDT_RFILETYPE               2205
  76. #define TXT_RDIRECTORY              2210
  77. #define LST_RDIRS                   2220
  78. #define LST_RDIRLST                 2225
  79. #define LST_RFILES                  2230
  80. #define BTN_RCHANGE                 2240
  81. #define BTN_RMKDIR                  2250
  82. #define BTN_RRMDIR                  2260
  83. #define BTN_RREFRESH                2275
  84. #define BTN_RHISTORY                2285
  85. #define BTN_RDISPLAY                2270
  86. #define BTN_RRENAME                 2280
  87. #define BTN_RDELETE                 2290
  88.  
  89. // transfer buttons
  90. #define BTN_LOCAL_TO_REMOTE         2310
  91. #define BTN_REMOTE_TO_LOCAL         2320
  92.  
  93. // configuration buttons
  94. #define RB_ASCII                    2410
  95. #define RB_BINARY                   2411
  96. #define RB_L8                       2412
  97.  
  98. // information text windows
  99. #define TXT_STATUS                  2510
  100. #define TXT_RBYTES                  2520
  101. #define TXT_LBYTES                  2530
  102.  
  103. // control buttons
  104. #define BTN_CONNECT                 2610
  105. #define BTN_CLOSE                   2620
  106. #define BTN_LONG                    2630
  107. #define BTN_ABORT                   2635
  108. #define BTN_OPTION                  2640
  109. #define BTN_ABOUT                   2645
  110. #define BTN_EXIT                    2650
  111.  
  112. // input dialog controls
  113. #define DLG_PROMPT                  3010
  114. #define DLG_EDIT                    3020
  115.  
  116. // **** connect dialog box controls
  117. #define DLG_EDT_HOST                4010
  118. #define DLG_EDT_USERID              4020
  119. #define DLG_EDT_PASSWD              4030
  120. #define DLG_HOST_TIMEOUT            4040
  121.  
  122. // **** status dlg identifiers
  123. #define CKB_BELL                    5010
  124. #define CKB_CRSTRIP                 5020
  125. #define CKB_GLOBBING                5030
  126. #define CKB_HASH                    5040
  127. #define CKB_PROMPT                  5050
  128. #define CKB_INTERACTIVE             5060
  129. #define CKB_MCASE                   5070
  130. #define CKB_PORT_CMDS               5080
  131. #define CKB_RECV_UNIQUE             5090
  132. #define CKB_STOR_UNIQUE             5100
  133. #define CKB_VERBOSE                 5110
  134. #define CKB_AUTOSTART               5120
  135. #define BTN_OPTIONS                 5130
  136. #define DLG_MAILADDR                5250
  137.  
  138. #define RB_SHOWCHECKS 8100
  139.  
  140. // **** misc definitions
  141. #define TYPE_I 'I'
  142. #define TYPE_A 'A'
  143. #define TYPE_E 'E'
  144. #define TYPE_L 'L'
  145.  
  146. #define FORM_N 'N'
  147. #define FORM_T 'T'
  148. #define FORM_C 'C'
  149.  
  150. #define MODE_S 'S'
  151. #define MODE_B 'B'
  152. #define MODE_C 'C'
  153.  
  154. #define DBUGWNDCLASS "WSDBUGWNDCLASS"
  155.  
  156. struct win_info 
  157. {
  158.   HWND hWnd;
  159.   int nLineHeight;
  160.   int nScreenRows;
  161.   int nMemPtr;
  162.   int nVpos;
  163.   LPSTR lpDebugMsg;
  164.   LPSTR lpMem[100];
  165. };
  166.  
  167. typedef struct HostConfig
  168. {
  169.   char szConfig[80];
  170.   char szHostName[80];
  171. } HOSTCONFIG, * LPHOSTCONFIG;
  172.  
  173. typedef struct HostInfo
  174. {
  175.   char szConfig[80];
  176.   char szHostName[80];
  177.   char szUserID[80];
  178.   char szPassword[80];
  179.   char szInitDir[80];
  180.   char szScript[80];
  181.   int  nType;
  182.   BOOL bSaveDir;
  183.   BOOL bFireWall;
  184.   UINT nTimeOut;
  185. } HOSTINFO, * LPHOSTINFO;
  186.  
  187. typedef struct 
  188. {
  189.   char szViewer[80];
  190.   char szDir[80];
  191.   char szExt[10];
  192.   char nTyp;
  193. } VIEWERCFG, *LPVIEWERCFG;
  194.  
  195. // **** function prototypes
  196.  
  197. // in ws_child.c
  198. int CreateSubWindows (HWND,HWND);
  199. int GetLocalDirForWnd (HWND);
  200. int GetRemoteDirForWnd(HWND);
  201. int ReadProcessHelp (HWND, SOCKET);
  202. int DoMainPaint (HWND hWnd);
  203. int GetButtonStatus (int);
  204. int GetButtonMsgStatus (int);
  205. int SetButtonStatus (int, int);
  206. int FindButtonClicked (int, int);
  207. int DoPaintButton (HWND, int, int);
  208. int GetButtonID (int);
  209. int SetStatus (HWND, LPSTR);
  210. int ScrollStatus (HWND, int);
  211. int UnsetStatusLines();
  212. int GetChildWindowID (LPARAM);
  213. int GetMaxStatusLines();
  214.  
  215. BOOL SetButtonEnabledStatus (int, BOOL);
  216. BOOL GetButtonEnabledStatus (int);
  217.  
  218. void ShowOurFlags (void);
  219. void CreateButtonPens (void);
  220. void DeleteButtonPens (void);
  221. void BoxIt (HDC, int, int, int, int, BOOL);
  222.  
  223. LPSTR FindName (LPSTR);
  224. LPSTR GetStatusLine (int nLine);
  225.  
  226. // in ws_con.c
  227. int getreply (SOCKET, LPSTR, BOOL);
  228. int command (SOCKET socket, char *fmt,...);
  229. int DoSTAT (SOCKET);
  230. int DoCHMOD (SOCKET,LPSTR,LPSTR);
  231. int DoCWD (SOCKET,LPSTR);
  232. int DoSystemCommand (SOCKET);
  233. int DoDirList (SOCKET,LPSTR);
  234. int DoDELE (SOCKET,LPSTR);
  235. int DoDisconnect (SOCKET);
  236. int DoMKD (SOCKET,LPSTR);
  237. int DoPWD (SOCKET);
  238. int DoQUOTE (SOCKET,LPSTR);
  239. int DoRMD (SOCKET,LPSTR);
  240. int DoDirList (SOCKET,LPSTR);
  241. int SendFile (SOCKET,LPSTR,LPSTR,char);
  242. int RetrieveFile (SOCKET,LPSTR,LPSTR,char);
  243. int SendPacket (SOCKET,LPSTR);
  244. int ForcePacket (SOCKET,LPSTR);
  245. int ReadDisplayLine (SOCKET);
  246. int ReadLine (SOCKET);
  247. int SendMass (SOCKET,LPSTR filename,BOOL);
  248. int ReadMass (SOCKET,LPSTR filename,BOOL);
  249. int ForceCommand (SOCKET s, LPSTR lpCmd, ...);
  250. char *onoff (BOOL);
  251. SOCKET DoClose (SOCKET sockfd);
  252. SOCKET DoConnect (LPSTR);
  253. SOCKET GetFTPListenSocket (SOCKET sockfd);
  254.  
  255. // in ws_ip.c
  256. SOCKET connectsock (char *host,char *service,char *protocol);
  257. SOCKET connectTCP (char *host,char *service);
  258. SOCKET connectUDP (char *host,char *service);
  259. int sendstr (SOCKET sockfd,LPSTR ptr,int nbytes, int *lpCode);
  260.  
  261. // in ws_debug.c
  262. int CreateDebugWindow (HWND hMainWnd,HWND hInst);
  263. LRESULT CALLBACK DebugWndProc (HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
  264. void SetDebugWindowText (LPSTR);
  265.  
  266. // in ws_error.c
  267. LPSTR ReturnWSError(UINT Err,LPSTR lpszBuf);
  268. void ReportWSError(LPSTR lpszMsg,UINT Err);
  269.  
  270. // in ws_main.c
  271.  
  272. LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
  273. BOOL CALLBACK WS_AboutMsgProc (HWND, UINT, WPARAM, LPARAM);
  274. BOOL CALLBACK WS_HostMsgProc (HWND, UINT, WPARAM, LPARAM);
  275. BOOL CALLBACK WS_InputMsgProc (HWND, UINT, WPARAM, LPARAM);
  276. BOOL CALLBACK WS_DeleteProc (HWND, UINT, WPARAM, LPARAM);
  277. BOOL CALLBACK WS_StatMsgProc (HWND, UINT, WPARAM, LPARAM);
  278. BOOL CALLBACK WS_FireWallSetupProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
  279.  
  280. int SubProcessAsync (HWND, UINT, WPARAM, LPARAM);
  281. int InitInstance (HINSTANCE);
  282. int ExecFTPApp (int);
  283. int CheckMsgQueue (HWND);
  284. int FindViewerIndex (LPSTR);
  285. int AddDirToList (HWND, int, LPSTR);
  286. int OnCmdLocalChangeDirLst (HWND);
  287. int OnCmdLocalChangeDir (HWND);
  288. int OnCmdLocalToRemote (HWND);
  289. int OnCmdLocalMakeDir (HWND);
  290. int OnCmdLocalRemoveDir (HWND);
  291. int OnCmdLocalDeleteFile (HWND);
  292. int OnCmdLocalRenameFile (HWND);
  293. int OnCmdLocalHistory (HWND);
  294. int OnCmdLocalDisplay (HWND);
  295. int OnCmdLButtonDblClkLocal (HWND);
  296. int OnCmdLocalRefresh (HWND);
  297. int OnCmdRemoteMakeDir (HWND);
  298. int OnCmdRemoteRemoveDir (HWND);
  299. int OnCmdRemoteDeleteFile (HWND);
  300. int OnCmdRemoteRenameFile (HWND);
  301. int OnCmdRemoteChangeDir (HWND);
  302. int OnCmdRemoteChangeDirLst (HWND);
  303. int OnCmdRemoteToLocal (HWND);
  304. int OnCmdRemoteRefresh (HWND);
  305. int OnCmdRemoteHistory (HWND);
  306. int OnCmdRemoteDisplay (HWND);
  307. int OnCmdLButtonDblClkRemote (HWND);
  308. int OnShowTransferType (HWND);
  309. int OnCmdConnectHost (HWND, WORD);
  310. int OnCmdListHost (HWND);
  311. int OnCmdNListHost (HWND, WORD);
  312. int OnCmdLogToFile (HWND, WORD);
  313. int OnCmdLogFileName (HWND, WORD);
  314. int OnCmdHelpHost (HWND);
  315. int OnCmdStatusHost (HWND);
  316. int OnCmdPWDHost (HWND);
  317. int OnCmdDirOpHost (HWND, WORD);
  318. int OnCmdGetFileHost (HWND);
  319. int OnCmdPutFileHost (HWND);
  320. int OnCmdQuoteHost (HWND);
  321. int OnCmdGetCwdHost (HWND);
  322. int OnCmdAbort (HWND);
  323. int OnCmdAbout (HWND);
  324. int OnCmdShowDebug (HWND, WORD);
  325. int OnCmdSaveDir (HWND, WORD);
  326. int OnCmdGetHostAddr (HWND, WORD);
  327. int OnCmdLFileType (HWND, WORD);
  328. int OnCmdRFileType (HWND, WORD);
  329. int OnCmdCloseOrExit (HWND, WPARAM);
  330. int nCwRegisterClasses (void );
  331.  
  332. void CleanupTempFiles (HWND);
  333. void CreateTempFileNames (LPSTR);
  334. void GetViewerInfo (HWND);
  335. void SetViewerInfo (HWND, int);
  336. void cwCenter (HWND, int);
  337. void CwUnRegisterClasses (void );
  338.  
  339. LPSTR GetViewer (LPSTR, LPSTR, LPSTR);
  340. LPSTR FindViewerName (LPSTR);
  341.  
  342. LRESULT OnCreate (HWND, UINT, WPARAM, LPARAM);
  343. LRESULT OnTimer (HWND, UINT, WPARAM, LPARAM);
  344. LRESULT OnWmCmd (HWND, UINT, WPARAM, LPARAM);
  345. LRESULT OnSetCursor (HWND, UINT, WPARAM, LPARAM);
  346. LRESULT OnPaint (HWND, UINT, WPARAM, LPARAM);
  347. LRESULT OnRButtonDown (HWND, UINT, WPARAM, LPARAM);
  348. LRESULT OnRButtonUp (HWND, UINT, WPARAM, LPARAM);
  349. LRESULT OnLButtonDown (HWND, UINT, WPARAM, LPARAM);
  350. LRESULT OnLButtonUp (HWND, UINT, WPARAM, LPARAM);
  351. LRESULT OnMouseMove (HWND, UINT, WPARAM, LPARAM);
  352. LRESULT OnVScroll (HWND, UINT, WPARAM, LPARAM);
  353. LRESULT OnCtlColor (HWND, UINT, WPARAM, LPARAM);
  354. LRESULT OnClose (HWND, UINT, WPARAM, LPARAM);
  355. LRESULT OnSetFocus (HWND, UINT, WPARAM, LPARAM);
  356. LRESULT OnKillFocus (HWND, UINT, WPARAM, LPARAM);
  357. LRESULT OnParentNotify (HWND, UINT, WPARAM, LPARAM);
  358. LRESULT OnDragDropFile (HWND, UINT, WPARAM, LPARAM);
  359.  
  360. // in ws_paint.c
  361. void ReleaseDisplayMem (VOID);
  362. void DoAddLine (LPSTR);
  363. void DoPrintf (char *fmt,...);
  364. void DoPaint (HWND);
  365. int GetLocalInfo (void);  
  366.  
  367. //in ws_host.c
  368. int  MakeLocalName(LPSTR szLocalName, LPSTR szRemoteName);
  369. int  ConvertTargetDir (LPSTR lpDir, int nSiz);
  370. int  ConvertSourceDir (LPSTR lpBuf, LPSTR lpDir, int nSiz);
  371. int RetrieveDirList (HWND);
  372. int SaveDirList (HWND);
  373. int UpdateDirListOpt (HWND, BOOL);
  374. void SaveUserInfo();
  375. void LoadUserInfo();
  376. void SetViewTyp (int, char);
  377. LPSTR GetHostName (int nI);
  378. LPSTR GetHostType (int nI);
  379. LPSTR GetHostTypeValue (int nI);
  380. LPSTR lpVuExt (int);
  381. LPSTR lpVuPgm (int);
  382. LPSTR lpVuDir (int);
  383. LPSTR ReAllocViewer (int);
  384. char GetViewTyp (int);
  385.  
  386. //in ws_local.c
  387. int OnCmdDropFiles (HWND hWnd, LPSTR *lParam);
  388. int OnCmdDisplayHostList (HWND hWnd, WORD wCtlID, WORD wNotifyCode);
  389. int DoRunScript (HWND hWnd, LPSTR lpScript);
  390. int OnCmdZoomInfo (HWND);
  391. void ClearZoomInfo();
  392. void AddMessageToView (LPSTR lpBuf, LPSTR lpHdr);
  393. void CreateUniqueName (LPSTR localname, LPSTR szName, LPSTR Ext);
  394. void SetTotalBytes (LONG lBytes);
  395. void SetXmitBytes (LONG lBytes);
  396. void OnPaintXfer (HWND hWnd);
  397. void CreateXferWindow();
  398. void DeleteXferWindow();
  399. void SetXferWindowText (LPSTR lpStr);
  400. LRESULT CALLBACK WndXferProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
  401. LRESULT CALLBACK WndMsgProc (HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
  402.  
  403. //in ws_icmp.c
  404. BOOL CALLBACK WS_FindHostProc (HWND, UINT, WPARAM, LPARAM);
  405.  
  406. #ifdef WIN32
  407.    #define setdisk(x)                  _chdrive (x)
  408. #else
  409.    #define setdisk(x)                  { int nDrv; _dos_setdrive (x, &nDrv); }   
  410. #endif
  411.  
  412. #define UNREFERENCED_PARAMETER(x)   (x)
  413.  
  414. #define DLG_HOST_ANONY              101
  415. #define DLG_HOST_SAVE               102
  416. #define DLG_HOST_PWD                103
  417.  
  418. #define HOST_AUTO                     0
  419. #define HOST_UNIX                     1
  420. #define HOST_IBM_VM                   2
  421. #define HOST_VMS_MULTINET             3
  422. #define HOST_VMS_UCX                  4
  423. #define HOST_PCTCP                    5
  424. #define HOST_NCSA                     6
  425. #define HOST_NOS                      7
  426. #define HOST_QVT                      8
  427. #define HOST_IBM_TCP                  9
  428. #define HOST_CHAMELEON               10
  429. #define HOST_SUPER                   11
  430. #define HOST_SINTFTPD                12
  431. #define HOST_MVS                     13
  432. #define HOST_U5000                   14
  433.  
  434. #define DLG_HOST_AUTO              (6000+HOST_AUTO)
  435. #define DLG_HOST_UNIX              (DLG_HOST_AUTO+HOST_UNIX)
  436. #define DLG_HOST_IBM_VM            (DLG_HOST_AUTO+HOST_IBM_VM)
  437. #define DLG_HOST_VMS_MULTINET      (DLG_HOST_AUTO+HOST_VMS_MULTINET)
  438. #define DLG_HOST_VMS_UCX           (DLG_HOST_AUTO+HOST_VMS_UCX)
  439. #define DLG_HOST_PCTCP             (DLG_HOST_AUTO+HOST_PCTCP)
  440. #define DLG_HOST_NCSA              (DLG_HOST_AUTO+HOST_NCSA)
  441. #define DLG_HOST_QVT               (DLG_HOST_AUTO+HOST_QVT)
  442. #define DLG_HOST_NOS               (DLG_HOST_AUTO+HOST_NOS)
  443. #define DLG_HOST_IBM_TCP           (DLG_HOST_AUTO+HOST_IBM_TCP)
  444. #define DLG_HOST_CHAMELEON         (DLG_HOST_AUTO+HOST_CHAMELEON)
  445. #define DLG_HOST_SUPER             (DLG_HOST_AUTO+HOST_SUPER)
  446. #define DLG_HOST_SINTFTPD          (DLG_HOST_AUTO+HOST_SINTFTPD)
  447. #define DLG_HOST_MVS               (DLG_HOST_AUTO+HOST_MVS)
  448. #define DLG_HOST_U5000             (DLG_HOST_AUTO+HOST_U5000)
  449.  
  450. #define DLG_HOST_LAST              DLG_HOST_U5000
  451.  
  452. #define DLG_HOST_DIR                105
  453.  
  454. #ifndef INADDR_NONE
  455. #define INADDR_NONE 0xffffffff
  456. #endif
  457.  
  458.